﻿using DtoFw.Base;
using System;
using System.Collections.Generic;
using System.Text;

namespace DtoFw
{
    /// <summary>
    /// 操作用户基类
    /// </summary>
    public class BaseOperator
    {
        /// <summary>
        /// 当前用户对象
        /// </summary>
        public TokenData CurrentUser { get; set; }
        /// <summary>
        /// 用户ID
        /// </summary>
        public long UserId
        {
            get
            {
                if (CurrentUser != null)
                    return CurrentUser.UserId;
                return 0;
            }
        }
        /// <summary>
        /// 用户账号
        /// </summary>
        public string UserCode
        {
            get
            {
                if (CurrentUser != null)
                    return CurrentUser.UserNo;
                return "";
            }
        }
        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName
        {
            get
            {
                if (CurrentUser != null)
                    return CurrentUser.UserName;
                return "";
            }
        }
        /// <summary>
        /// 机构Id
        /// </summary>
        public long OrganId
        {
            get
            {
                if (CurrentUser != null)
                    return CurrentUser.OrganId;
                return 0;
            }
        }
        /// <summary>
        /// 机构名
        /// </summary>
        public string OrganName
        {
            get
            {
                if (CurrentUser != null)
                    return CurrentUser.OrganName;
                return "";
            }
        }
        /// <summary>
        /// 联系电话
        /// </summary>
        public string Mobile
        {
            get
            {
                if (CurrentUser != null)
                    return CurrentUser.Mobile;
                return "";
            }
        }
        /// <summary>
        /// 联系电话
        /// </summary>
        public string ComNo
        {
            get
            {
                if (CurrentUser != null)
                    return CurrentUser?.ComNo;
                return "";
            }
        }
        /// <summary>
        /// 机构Id
        /// </summary>
        public long DeptId
        {
            get
            {
                if (CurrentUser != null)
                    return CurrentUser.DeptId;
                return 0;
            }
        }
        /// <summary>
        /// 单位类型：1录入人所属单位、2主办人所属单位
        /// </summary>
        public int organType { get; set; }
    }
}
